package com.sykj.seaflow.common.mp.handler;

import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.LongValue;
import com.sykj.seaflow.common.base.holder.TenantContextHolder;
import org.springframework.stereotype.Component;

@Component
public class SeaFlowTenantHandler implements TenantLineHandler {
    @Override
    public Expression getTenantId() {
        Long tenantId = TenantContextHolder.getTenantId();

        return new LongValue(tenantId);
    }
    @Override
    public String getTenantIdColumn() {
        return "tenant_id";
    }

    @Override
    public boolean ignoreTable(String tableName) {
        // 根据需要返回是否忽略该表
        return false;
    }

}
